package ru.ifmo.rybakov.muclumon.analysis;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import ru.ifmo.rybakov.muclumon.Property;
import ru.ifmo.rybakov.muclumon.Task;

@Deprecated
public class TaskClusterMetrics {

	private TaskCluster cluster;
	
	public TaskClusterMetrics(TaskCluster cluster) {
		this.cluster = cluster;
		calculatePropertyWeights();
	}
	
	private final Map<Property, Double> weights = new HashMap<Property, Double>();
	
	private void calculatePropertyWeights() {
		for (Task task : cluster.getTasks()) {
			for (Property p : task.getPropertySet()) {
//				Double weight = weights.get(p);
//				weights.put(p, (weight == null) ? 1.0 : (weight + 1.0));
				weights.put(p, 1.0);
			}
		}
		
		// normalize weights
//		Iterator<Entry<Property, Double>> weightIterator = weights.entrySet().iterator();
//		while (weightIterator.hasNext()) {
//			Entry<Property, Double> weightEntry = weightIterator.next();
//			weightEntry.setValue(weightEntry.getValue() / cluster.getTasks().size());
//		}
	}
	
	public Map<Property, Double> getPropertyWeights() {
		return Collections.unmodifiableMap(weights);
	}
}
